\(\int \frac {\sec (e+f x)}{(a+a \sec (e+f x)) (c+d \sec (e+f x))} \, dx\) [214]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 31, antiderivative size = 83 \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x)) (c+d \sec (e+f x))} \, dx=-\frac {2 d \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{a (c-d)^{3/2} \sqrt {c+d} f}+\frac {\tan (e+f x)}{(c-d) f (a+a \sec (e+f x))} \]

[Out]

-2*d*arctanh((c-d)^(1/2)*tan(1/2*f*x+1/2*e)/(c+d)^(1/2))/a/(c-d)^(3/2)/f/(c+d)^(1/2)+tan(f*x+e)/(c-d)/f/(a+a*s
ec(f*x+e))

Rubi [A] (verified)

Time = 0.20 (sec) , antiderivative size = 134, normalized size of antiderivative = 1.61, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.129, Rules used = {4072, 98, 95, 211} \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x)) (c+d \sec (e+f x))} \, dx=\frac {2 d \tan (e+f x) \arctan \left (\frac {\sqrt {c+d} \sqrt {a \sec (e+f x)+a}}{\sqrt {c-d} \sqrt {a-a \sec (e+f x)}}\right )}{f (c-d)^{3/2} \sqrt {c+d} \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}+\frac {\tan (e+f x)}{f (c-d) (a \sec (e+f x)+a)} \]

[In]

Int[Sec[e + f*x]/((a + a*Sec[e + f*x])*(c + d*Sec[e + f*x])),x]

[Out]

Tan[e + f*x]/((c - d)*f*(a + a*Sec[e + f*x])) + (2*d*ArcTan[(Sqrt[c + d]*Sqrt[a + a*Sec[e + f*x]])/(Sqrt[c - d
]*Sqrt[a - a*Sec[e + f*x]])]*Tan[e + f*x])/((c - d)^(3/2)*Sqrt[c + d]*f*Sqrt[a - a*Sec[e + f*x]]*Sqrt[a + a*Se
c[e + f*x]])

Rule 95

Int[(((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_))/((e_.) + (f_.)*(x_)), x_Symbol] :> With[{q = Denomin
ator[m]}, Dist[q, Subst[Int[x^(q*(m + 1) - 1)/(b*e - a*f - (d*e - c*f)*x^q), x], x, (a + b*x)^(1/q)/(c + d*x)^
(1/q)], x]] /; FreeQ[{a, b, c, d, e, f}, x] && EqQ[m + n + 1, 0] && RationalQ[n] && LtQ[-1, m, 0] && SimplerQ[
a + b*x, c + d*x]

Rule 98

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[b*(a +
b*x)^(m + 1)*(c + d*x)^(n + 1)*((e + f*x)^(p + 1)/((m + 1)*(b*c - a*d)*(b*e - a*f))), x] + Dist[(a*d*f*(m + 1)
 + b*c*f*(n + 1) + b*d*e*(p + 1))/((m + 1)*(b*c - a*d)*(b*e - a*f)), Int[(a + b*x)^(m + 1)*(c + d*x)^n*(e + f*
x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && EqQ[Simplify[m + n + p + 3], 0] && (LtQ[m, -1] || Sum
SimplerQ[m, 1])

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 4072

Int[(csc[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]
*(d_.) + (c_))^(n_), x_Symbol] :> Dist[a^2*g*(Cot[e + f*x]/(f*Sqrt[a + b*Csc[e + f*x]]*Sqrt[a - b*Csc[e + f*x]
])), Subst[Int[(g*x)^(p - 1)*(a + b*x)^(m - 1/2)*((c + d*x)^n/Sqrt[a - b*x]), x], x, Csc[e + f*x]], x] /; Free
Q[{a, b, c, d, e, f, g, m, n, p}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && (EqQ[p,
 1] || IntegerQ[m - 1/2])

Rubi steps \begin{align*} \text {integral}& = -\frac {\left (a^2 \tan (e+f x)\right ) \text {Subst}\left (\int \frac {1}{\sqrt {a-a x} (a+a x)^{3/2} (c+d x)} \, dx,x,\sec (e+f x)\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}} \\ & = \frac {\tan (e+f x)}{(c-d) f (a+a \sec (e+f x))}+\frac {(a d \tan (e+f x)) \text {Subst}\left (\int \frac {1}{\sqrt {a-a x} \sqrt {a+a x} (c+d x)} \, dx,x,\sec (e+f x)\right )}{(c-d) f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}} \\ & = \frac {\tan (e+f x)}{(c-d) f (a+a \sec (e+f x))}+\frac {(2 a d \tan (e+f x)) \text {Subst}\left (\int \frac {1}{a c-a d-(-a c-a d) x^2} \, dx,x,\frac {\sqrt {a+a \sec (e+f x)}}{\sqrt {a-a \sec (e+f x)}}\right )}{(c-d) f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}} \\ & = \frac {\tan (e+f x)}{(c-d) f (a+a \sec (e+f x))}+\frac {2 d \arctan \left (\frac {\sqrt {c+d} \sqrt {a+a \sec (e+f x)}}{\sqrt {c-d} \sqrt {a-a \sec (e+f x)}}\right ) \tan (e+f x)}{(c-d)^{3/2} \sqrt {c+d} f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 1.06 (sec) , antiderivative size = 160, normalized size of antiderivative = 1.93 \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x)) (c+d \sec (e+f x))} \, dx=\frac {2 \cos \left (\frac {1}{2} (e+f x)\right ) \left (\frac {2 d \arctan \left (\frac {(i \cos (e)+\sin (e)) \left (c \sin (e)+(-d+c \cos (e)) \tan \left (\frac {f x}{2}\right )\right )}{\sqrt {c^2-d^2} \sqrt {(\cos (e)-i \sin (e))^2}}\right ) \cos \left (\frac {1}{2} (e+f x)\right ) (i \cos (e)+\sin (e))}{\sqrt {c^2-d^2} \sqrt {(\cos (e)-i \sin (e))^2}}+\sec \left (\frac {e}{2}\right ) \sin \left (\frac {f x}{2}\right )\right )}{a (c-d) f (1+\cos (e+f x))} \]

[In]

Integrate[Sec[e + f*x]/((a + a*Sec[e + f*x])*(c + d*Sec[e + f*x])),x]

[Out]

(2*Cos[(e + f*x)/2]*((2*d*ArcTan[((I*Cos[e] + Sin[e])*(c*Sin[e] + (-d + c*Cos[e])*Tan[(f*x)/2]))/(Sqrt[c^2 - d
^2]*Sqrt[(Cos[e] - I*Sin[e])^2])]*Cos[(e + f*x)/2]*(I*Cos[e] + Sin[e]))/(Sqrt[c^2 - d^2]*Sqrt[(Cos[e] - I*Sin[
e])^2]) + Sec[e/2]*Sin[(f*x)/2]))/(a*(c - d)*f*(1 + Cos[e + f*x]))

Maple [A] (verified)

Time = 0.70 (sec) , antiderivative size = 74, normalized size of antiderivative = 0.89

method result size
derivativedivides \(\frac {\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{c -d}-\frac {2 d \,\operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (c -d \right ) \sqrt {\left (c +d \right ) \left (c -d \right )}}}{f a}\) \(74\)
default \(\frac {\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{c -d}-\frac {2 d \,\operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (c -d \right ) \sqrt {\left (c +d \right ) \left (c -d \right )}}}{f a}\) \(74\)
risch \(\frac {2 i}{f a \left (c -d \right ) \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}+\frac {d \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i c^{2}+i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{c \sqrt {c^{2}-d^{2}}}\right )}{\sqrt {c^{2}-d^{2}}\, \left (c -d \right ) f a}-\frac {d \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right )}{\sqrt {c^{2}-d^{2}}\, \left (c -d \right ) f a}\) \(188\)

[In]

int(sec(f*x+e)/(a+a*sec(f*x+e))/(c+d*sec(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f/a*(tan(1/2*f*x+1/2*e)/(c-d)-2*d/(c-d)/((c+d)*(c-d))^(1/2)*arctanh((c-d)*tan(1/2*f*x+1/2*e)/((c+d)*(c-d))^(
1/2)))

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 353, normalized size of antiderivative = 4.25 \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x)) (c+d \sec (e+f x))} \, dx=\left [-\frac {\sqrt {c^{2} - d^{2}} {\left (d \cos \left (f x + e\right ) + d\right )} \log \left (\frac {2 \, c d \cos \left (f x + e\right ) - {\left (c^{2} - 2 \, d^{2}\right )} \cos \left (f x + e\right )^{2} + 2 \, \sqrt {c^{2} - d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )} \sin \left (f x + e\right ) + 2 \, c^{2} - d^{2}}{c^{2} \cos \left (f x + e\right )^{2} + 2 \, c d \cos \left (f x + e\right ) + d^{2}}\right ) - 2 \, {\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}{2 \, {\left ({\left (a c^{3} - a c^{2} d - a c d^{2} + a d^{3}\right )} f \cos \left (f x + e\right ) + {\left (a c^{3} - a c^{2} d - a c d^{2} + a d^{3}\right )} f\right )}}, -\frac {\sqrt {-c^{2} + d^{2}} {\left (d \cos \left (f x + e\right ) + d\right )} \arctan \left (-\frac {\sqrt {-c^{2} + d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )}}{{\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}\right ) - {\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}{{\left (a c^{3} - a c^{2} d - a c d^{2} + a d^{3}\right )} f \cos \left (f x + e\right ) + {\left (a c^{3} - a c^{2} d - a c d^{2} + a d^{3}\right )} f}\right ] \]

[In]

integrate(sec(f*x+e)/(a+a*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="fricas")

[Out]

[-1/2*(sqrt(c^2 - d^2)*(d*cos(f*x + e) + d)*log((2*c*d*cos(f*x + e) - (c^2 - 2*d^2)*cos(f*x + e)^2 + 2*sqrt(c^
2 - d^2)*(d*cos(f*x + e) + c)*sin(f*x + e) + 2*c^2 - d^2)/(c^2*cos(f*x + e)^2 + 2*c*d*cos(f*x + e) + d^2)) - 2
*(c^2 - d^2)*sin(f*x + e))/((a*c^3 - a*c^2*d - a*c*d^2 + a*d^3)*f*cos(f*x + e) + (a*c^3 - a*c^2*d - a*c*d^2 +
a*d^3)*f), -(sqrt(-c^2 + d^2)*(d*cos(f*x + e) + d)*arctan(-sqrt(-c^2 + d^2)*(d*cos(f*x + e) + c)/((c^2 - d^2)*
sin(f*x + e))) - (c^2 - d^2)*sin(f*x + e))/((a*c^3 - a*c^2*d - a*c*d^2 + a*d^3)*f*cos(f*x + e) + (a*c^3 - a*c^
2*d - a*c*d^2 + a*d^3)*f)]

Sympy [F]

\[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x)) (c+d \sec (e+f x))} \, dx=\frac {\int \frac {\sec {\left (e + f x \right )}}{c \sec {\left (e + f x \right )} + c + d \sec ^{2}{\left (e + f x \right )} + d \sec {\left (e + f x \right )}}\, dx}{a} \]

[In]

integrate(sec(f*x+e)/(a+a*sec(f*x+e))/(c+d*sec(f*x+e)),x)

[Out]

Integral(sec(e + f*x)/(c*sec(e + f*x) + c + d*sec(e + f*x)**2 + d*sec(e + f*x)), x)/a

Maxima [F(-2)]

Exception generated. \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x)) (c+d \sec (e+f x))} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate(sec(f*x+e)/(a+a*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*c^2-4*d^2>0)', see `assume?`
 for more de

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.33 \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x)) (c+d \sec (e+f x))} \, dx=\frac {\frac {2 \, {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, c - 2 \, d\right ) + \arctan \left (\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-c^{2} + d^{2}}}\right )\right )} d}{{\left (a c - a d\right )} \sqrt {-c^{2} + d^{2}}} + \frac {\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{a c - a d}}{f} \]

[In]

integrate(sec(f*x+e)/(a+a*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="giac")

[Out]

(2*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(2*c - 2*d) + arctan((c*tan(1/2*f*x + 1/2*e) - d*tan(1/2*f*x + 1/2*e))
/sqrt(-c^2 + d^2)))*d/((a*c - a*d)*sqrt(-c^2 + d^2)) + tan(1/2*f*x + 1/2*e)/(a*c - a*d))/f

Mupad [B] (verification not implemented)

Time = 13.58 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.33 \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x)) (c+d \sec (e+f x))} \, dx=\frac {\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}{a\,f\,\left (c-d\right )}-\frac {2\,d\,\mathrm {atanh}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,c^2-2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,c\,d+\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,d^2}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c+d}\,{\left (c-d\right )}^{3/2}}\right )}{a\,f\,\sqrt {c+d}\,{\left (c-d\right )}^{3/2}} \]

[In]

int(1/(cos(e + f*x)*(a + a/cos(e + f*x))*(c + d/cos(e + f*x))),x)

[Out]

tan(e/2 + (f*x)/2)/(a*f*(c - d)) - (2*d*atanh((c^2*sin(e/2 + (f*x)/2) + d^2*sin(e/2 + (f*x)/2) - 2*c*d*sin(e/2
 + (f*x)/2))/(cos(e/2 + (f*x)/2)*(c + d)^(1/2)*(c - d)^(3/2))))/(a*f*(c + d)^(1/2)*(c - d)^(3/2))